#ifndef __STRUCT_DEF_H
#define __STRUCT_DEF_H

#include <Arduino.h>
#include <time.h>

typedef enum {
    DIRECTION_TOP_EDGE        = 0,   
    DIRECTION_BOTTOM_EDGE     = 1,   
    DIRECTION_LEFT_EDGE       = 2,    
    DIRECTION_RIGHT_EDGE      = 3,   
    DIRECTION_DISP_UP         = 4,   
    DIRECTION_DISP_DOWN       = 5   
} direction_t;

typedef enum{
    MSG_WIFI,
    MSG_TIME,
    MSG_VOLUME,
    MSG_POWER,
    MSG_MOTION,
    MSG_WEATHER,
}msg_type_t;


typedef enum{
    WIFI_CONFIG_SCAN=0,
    WIFI_CONFIG_SCAN_DONE,
    WIFI_CONFIG_CONNECT_SUCCESS,
    WIFI_CONFIG_CONNECT_FAIL,
    WIFI_CONFIG_TRY_CONNECT,
}wifi_config_event_t;


typedef enum{
    MOTION_STOP,
    MOTION_GET_ACC,
    MOTION_GET_STEP,
}motion_event_t;

typedef enum{
    ENVIRONMENT_STOP,
    ENVIRONMENT_GET,
     
}environment_event_t;

typedef enum{
    WEATHER_SYNC_START,
    WEATHER_SYNC_DONE,
     
}weather_event_t;

typedef enum{
    TIME_UPDATE,
    TIME_SYNC,
    TIME_ALARM,
}time_event_t;




//struct
typedef struct {
    char ssid[64];
    char password[64];
} wifi_auth_t;

typedef struct  {
    wifi_config_event_t event;
    void *ctx;
} wifi_struct_t;

typedef struct  {
    motion_event_t event;
    direction_t dir;
    uint32_t setp;
} motion_struct_t;

typedef struct {
    time_event_t event;
    struct tm time;
} time_struct_t;


typedef struct{
    environment_event_t event;
    void *ctx;
}environment_struct_t;


typedef struct{
    weather_event_t event;
    void *ctx;
}weather_struct_t;

typedef struct{
    union{
        wifi_struct_t wifi;
        motion_struct_t motion;
        environment_struct_t environment;
        time_struct_t time;
        weather_struct_t wewather;
    };
    void *arg;
    msg_type_t type;
}task_event_data_t;




#endif

